<html>
<%@ page language="java" errorPage="/error.jsp" pageEncoding="UTF-8" contentType="text/html; charset=utf-8" %>
<%@include file="/quick/include/common.jsp"%>
<%@include file="/quick/include/globalScope.jsp"%>
  <head>
    <title><c:out value="${model.title}"/></title>
  </head>
<script>
Ext.onReady(function(){
	var yearStore=new Ext.data.SimpleStore({
     'fields':['value','text'],
     data:<c:out value="${model.yearJson}" escapeXml='false' />
	});
	var semesterStore=new Ext.data.SimpleStore({
     'fields':['value','text'],
     data:<c:out value="${model.semesterJson}" escapeXml='false' />
	});
	var reportStore=new Ext.data.SimpleStore({
     'fields':['value','text'],
     data:[['01','成绩等级人数'],['02','成绩等级比例']]
	});
    
	var form = new Ext.form.FormPanel({
	      labelAlign:'right',
	      title:'课程成绩分析',
	      labelWidth:80,
	      region:'north',
	      height:g_height/3,
	      frame:true,
	      width:320,
		  url:g_rootPath+'ajax/system/parameter/save.html',	      
	      items:[{
            xtype:'combo',   
            fieldLabel:'学年度',  
            store: yearStore,   
            editable: false,   
            hiddenName:'SCHOOL_YEAR',   
            id:'_SCHOOL_YEAR',   
            displayField:'text',   
            valueField:'value',   
            typeAhead:true,   
            mode: 'local',   
            triggerAction: 'all',   
            emptyText:'请选择',   
            selectOnFocus:true,   
            resizable:true,   
            allowBlank:false,   
            anchor:'90%',
            forceSelection:true           
         },{
            xtype:'combo',   
            fieldLabel:'学期',   
            store: semesterStore,   
            editable: false,   
            hiddenName:'SCHOOL_SEMESTER',   
            id:'_SCHOOL_SEMESTER',   
            displayField:'text',   
            valueField:'value',   
            typeAhead:true,   
            mode: 'local',   
            triggerAction: 'all',   
            emptyText:'请选择',   
            selectOnFocus:true,   
            resizable:true,   
            allowBlank:false,   
            anchor:'90%',
            forceSelection:true           
         },{
            xtype:'combo',   
            fieldLabel:'统计方式',   
            store: reportStore,   
            editable: false,   
            hiddenName:'REPORT_FORMAT',   
            id:'_REPORT_FORMAT',   
            displayField:'text',   
            valueField:'value',   
            typeAhead:true,   
            mode: 'local',   
            triggerAction: 'all',   
            emptyText:'请选择',   
            selectOnFocus:true,   
            resizable:true,   
            allowBlank:false,   
            anchor:'90%',
            forceSelection:true           
         }],
         buttons:[{text:'打印',handler:function(){
           f_print(form);
         }},{text:'重置',handler:function(){
           form.getForm().reset();
         }}] 
          
	});
	
	form.render('parameter_form');   
   
    var gradeCombo=form.getForm().findField('_GRADE');
    var yearCollegeCombo=form.getForm().findField('_YEAR_COLLEGE');
    var gradeMajorCombo=form.getForm().findField('_GRADE_MAJOR');
    
    
   
});

function f_print(form){

  var year=form.getForm().findField('_SCHOOL_YEAR').getValue();
  var semester=parseInt(form.getForm().findField('_SCHOOL_SEMESTER').getValue());
  var yearName=form.getForm().findField('_SCHOOL_YEAR').getRawValue();
  var semesterName=form.getForm().findField('_SCHOOL_SEMESTER').getRawValue();

  var xnd='SCHOOL_YEAR[$]'+year;
  var xq='SCHOOL_SEMESTER[$]'+semester;
  var xndmc='SCHOOL_YEAR_NAME[$]'+yearName;
  var xqmc='SCHOOL_SEMESTER_NAME[$]'+semesterName;
  
  var reportFormat=form.getForm().findField('_REPORT_FORMAT').getValue();
  var jasper;
  if(reportFormat=='01'){
    jasper='/web-inf/pages/score/print/course_score_statistic.jasper';
  }else{
    jasper='/web-inf/pages/score/print/course_score_ratio_statistic.jasper';
  }
  
  
  var matrix=[['jasper',jasper],
        ['params',xnd],['params',xq],['params',xndmc],['params',xqmc]
        ];
  var form=createForm(g_rootPath+'pdf/print.html',matrix);
//  var form=createForm(g_rootPath+'educational/score/semesterScorePrint.html',matrix);
  form.target="_blank";
  form.submit();
}
</script>  
    <c:if test="${not empty message}">
      <div  align="left" id="title" style="height:40px;vertical-align:bottom;bgcolor:blue;"><br><h3><STRONG><c:out value='${message}'/></STRONG></h3></div>
    </c:if>

<br>
<br>
<br>


<div id="parameter_form" align=center></div>  
  
</html>   
